#include "MatchAlarmReportResponse.h"


MatchAlarmReportResponse::MatchAlarmReportResponse(const QString &factoryNo, const QString &transId, const QString &eventTime, const QString &resultCode, const QString &resultMsg)
{

}

bool MatchAlarmReportResponse::fromJson(const QByteArray &jsonData)
{
    bool rtn = false;
    QJsonDocument doc = QJsonDocument::fromJson(jsonData);

    if(doc.isNull())
    {
        success = false;
        rtn = false;
    }
    else
    {
        QJsonObject json = doc.object();
        factoryNo = json["factoryNo"].toString();
        transId = json["transId"].toString();
        eventTime = QDateTime::fromString(json["eventTime"].toString());
        resultCode = json["resultCode"].toString();
        resultMsg = json["resultMsg"].toString();
        success = json["resultCode"].toBool();
        if(resultCode == "0")
        {
            success = true;
            rtn = true;
        }
        else
        {
            success = false;
            rtn = false;
        }
    }

    return rtn;
}
